<script>
$(document).ready(function() { 

$("#nav li").hover(function(){ 

        $(this).find('div:first').css({visibility: "visible",display: "none"}).show(400); 
        },function(){ 
        $(this).find('div:first').css({visibility: "hidden"}); 

        }); 
});  
</script>
<style>
#nav li:hover ul div, 
#nav li:hover ul ul div,
#nav li:hover ul ul ul div {
    display: none;
}

#nav li:hover div,
#nav li li:hover div,
#nav li li li:hover div,
#nav li li li li:hover div {
    display: block;
}
#nav li {
    float: left;
    position: relative;
	width:150px;
}
#nav li a{ display:block; padding-right:10px}

#nav ul div {
    position: absolute!important;
    width: 12em;
	top:-10px;
    display: none;
	left:155px;
	background-color:#000;
	padding:10px 0px 5px 15px
}
#nav, #nav ul {
    list-style:  none;
    position: relative;
    line-height: 1.5em;
}
</style>
<div id="menu">
  <ul id="nav" >
   <!-- get content from categories -->
  <?php $mainmenu=main_menu();
  		while($row_mm=mysql_fetch_assoc($mainmenu)){
  ?>
        <li class="arrow_down"><a href="#"><?php echo $row_mm['title']?></a>
            <div style="">               
                <ul style="">
                	<?php $sub=main_menu_sub($row_mm['id']);
						while($row_sub=mysql_fetch_assoc($sub)){
					?>
                         <li class="arrow_down"><a href="#"><?php echo $row_sub['title']?></a>
                         <?php $sub2=main_menu_sub($row_sub['id']);
						 		if(mysql_num_rows($sub2)>0){
						 ?>
    						 <div>
                				<ul style="">	
                                <?php 
						while($row_sub2=mysql_fetch_assoc($sub2)){
					?>
                                	<li><a href="index.php?view=news&catid=<?php echo $row_sub2['id']?>"><?php echo $row_sub2['title']?></a></li>  
                                    <?php }?>                   
	                         	</ul>
                          </div>  
                          <?php }?>
                         </li>                         
					<?php }?>                   		
                </ul>                 
              </div>
          </li>          
    <?php }?><!-- end get content from categories -->    		
      </ul>
</div>